package com.yiren.manager.service.impl.vip;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yiren.core.exception.MyException;
import com.yiren.core.service.GenericServiceImpl;
import com.yiren.core.utils.Favorites;
import com.yiren.entity.YrUserVipCard;
import com.yiren.entity.YrUserVipCardRent;
import com.yiren.manager.repository.vip.YrUserVipCardRentRepository;
import com.yiren.manager.repository.vip.YrUserVipCardRepository;
import com.yiren.manager.service.iface.vip.YrUserVipCardRentService;

@Service("yrUserVipCardRentService")
public class YrUserVipCardRentServiceImpl extends GenericServiceImpl<YrUserVipCardRent, String> implements YrUserVipCardRentService{

	@Autowired
	private YrUserVipCardRepository userVipCardRepository;
	
	@Autowired
	public YrUserVipCardRentServiceImpl(YrUserVipCardRentRepository repository) {
		super(repository);
	}

	@Transactional
	public void addByFavorites(Favorites entitys) throws MyException {
		YrUserVipCardRent userVipCardRent  = entitys.getFavorite(YrUserVipCardRent.class);
		YrUserVipCard userVipCard = entitys.getFavorite(YrUserVipCard.class);
		
		userVipCardRepository.save(userVipCard);
		this.repository.save(userVipCardRent);
	}

	@Transactional
	public void modifyByFavorites(Favorites entitys) throws MyException {
		// TODO Auto-generated method stub
		
	}

}
